/* 
 * File:   MDate.c
 * Author: Muhammad Anis
 */

#include <stdio.h>
#include <stdlib.h>

#include "Date.h"

/*
 * 
 */
int main(int argc, char** argv) {
    
    /* Make Date Valid Test Case */
    Date d1 = MakeDate(2012, 10, 20);
    if (IsDateValid(2012, 10, 10)) {
        printf("Date Valid ");
    } else {
        printf("Date Not Valid ");
    }
    PrintDate(d1);

    /* Make Date Not Valid Test Case */
    Date d2 = MakeDate(2012, 32, 10);
    if (IsDateValid(2012, 32, 10)) {
        printf("Date Valid ");
    } else {
        printf("Date Not Valid ");
    }
    PrintDate(d2);

    Date d3 = MakeDate(2013, 10, 20);
    PrintDate(d3);
    // bandingkan d1 dengan d3
    if (DateLessThan(d1, d3)) {
        printf("d1 < d3 \n");
    } else {
        printf("d3 < d1 \n");
    }
    /* Tomorrow */
    PrintDate(NextDay(d3));
    PrintDate(Yesterday(d3));
    printf("Seconds: %lld\n", DateToSecond(d3));
    PrintDate(SecondToDate(DateToSecond(d3)));
    Date d4 = MakeDate(2000, 3, 3);
    printf("Days diff : %d\n", DaysDiff(d3, d4));
    Date d5 = AddDate(d3, d4);
    PrintDate(d5);
    PrintDate(d4);
    AfterDate(&d4, d3);
    PrintDate(d4);
    printf("Days diff 4 : %d\n", DaysDiff(MakeDate(1900,1,1), MakeDate(1900,1,2)));
    printf("Hari pertama bulan lalu : %d\n", GetFirstDay(2012, 9));
    printf("Hari pertama bulan ini : %d\n", GetFirstDay(2012, 10));
    printf("Hari pertama bulan depan : %d\n", GetFirstDay(2012, 11));    
    return (EXIT_SUCCESS);
}

